package ly.gupao.edu.threaddemo.syn.objectClass;

public class SynchronizedTest {

    static synchronized void threadMethodA(){
        System.out.println("name = " + Thread.currentThread().getName() + " begin!");
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("name = " + Thread.currentThread().getName() + " end!");
    }

    static synchronized void threadMethodB(){
        System.out.println("name = " + Thread.currentThread().getName() + " begin!");
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("name = " + Thread.currentThread().getName() + " end!");
    }

    synchronized void threadMethodC(){
        System.out.println("name = " + Thread.currentThread().getName() + " begin!");
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("name = " + Thread.currentThread().getName() + " end!");
    }


}
